<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面</title>
    <link rel="shortcut icon" href="#" />
    <link rel="stylesheet" href="css/element-ui.css" />
    <script src="js/vue.js"></script>
    <script src="js/element-ui.js"></script>
</head>
<body>
<div id="app">
    <el-container>
        <el-header>
            <div style="text-align: right">
                <el-row>
                    <el-dropdown>
                            <span class="el-dropdown-link">
                                {{username}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item>个人中心</el-dropdown-item>
                            <el-dropdown-item>退出登陆</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                    <el-avatar :size="60" :src="avatar"  @error="errorHandler" shape="square">
                        <img src="imgs/error.png"/>
                    </el-avatar>
                </el-row>
            </div>
        </el-header>
        <el-container>
            <el-aside :width="asideWidth">
                <div style="width: 100%; height: 80px; line-height: 50px;">
                    <h3>{{title}}</h3>
                </div>
                <el-radio-group v-model="isCollapse" style="margin-bottom: 20px;">
                    <el-radio-button :label="false">展开</el-radio-button>
                    <el-radio-button :label="true">收起</el-radio-button>
                </el-radio-group>
                <el-menu default-active="1-1" class="el-menu-vertical-demo"
                         @open="handleOpen" @close="handleClose" :collapse="isCollapse" background-color="#D3DCE6">
                    <el-submenu index="1">
                        <template slot="title">
                            <span slot="title" style="font-weight: bold">用户管理</span>
                        </template>
                        <el-menu-item index="1-1"><a href="userlist.html" target="main">用户列表</a></el-menu-item>
                        <el-menu-item index="1-2"><a href="userLogin.html" target="main">个人中心</a> </el-menu-item>
                    </el-submenu>
                    <el-submenu index="2">
                        <template slot="title">
                            <span slot="title" style="font-weight: bold">角色管理</span>
                        </template>
                        <el-menu-item index="2-1">角色列表</el-menu-item>
                        <el-menu-item index="2-2">添加角色</el-menu-item>
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-main>
                <iframe name="main" src="鲜花页面.html" width="100%" height="90%" frameborder="0"></iframe>
            </el-main>
        </el-container>
    </el-container>
</div>
</body>
<script>
    let username = sessionStorage.getItem("username");
    let avatars = sessionStorage.getItem("avatar"); // 存储了用户头像的 URL
    let vm = new Vue({
        el: '#app',
        data() {
            return {
                isCollapse: false,
                asideWidth: '200px',
                title: '蜗牛管理系统',
                username: username,
                avatar: avatars
            }
        },
        methods: {
            handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClick() {
                alert('button click');
            }
        }
    });
</script>
<style>
    .el-header, .el-footer {
        background-color: #B3C0D1;
        color: #333;
        text-align: center;
        line-height: 60px;
    }

    .el-aside {
        background-color: #D3DCE6;
        color: #333;
        text-align: center;
        height: 90vh; /* wh表示按照比例划分 */
    }

    .el-main {
        background-color: #E9EEF3;
        color: #333;
        text-align: center;
        line-height: 160px;
    }

    body {
        margin: 0px;
        padding: 0px;
    }

    body > .el-container {
        margin-bottom: 40px;
    }

    .el-container:nth-child(5) .el-aside,
    .el-container:nth-child(6) .el-aside {
        line-height: 260px;
    }

    .el-container:nth-child(7) .el-aside {
        line-height: 320px;
    }

    li {
        list-style: none;
    }

    a {
        text-decoration: none;
    }

    .el-menu-vertical-demo:not(.el-menu--collapse) {
        width: 200px;
        min-height: 400px;
    }

    .el-dropdown {
        vertical-align: top;
    }
    .el-dropdown + .el-dropdown {
        margin-left: 15px;
    }
    .el-icon-arrow-down {
        font-size: 12px;
    }
</style>
</html>
